--Declare the CURSOR object and the query that populates it
DECLARE SomeCursor CURSOR
FOR
	SELECT
		MCS.ServiceBeginDate,
		MCS.ServiceEndDate,
		MCS.MonthlyCostShareAmt,
		MCS.RateCode
	FROM
		healthpas_common.dbo.CS_MonthlyCostShare AS MCS

--Open the cursor
OPEN SomeCursor		

--DECLARE Container Variables for use within the cursor		
DECLARE @EffectiveDate DATETIME
DECLARE @TerminationDate DATETIME
DECLARE @SOCAmount MONEY
DECLARE @RateCode CHAR(2)

--
FETCH NEXT FROM SomeCursor INTO @EffectiveDate, @TerminationDate, @SOCAmount, @RateCode
WHILE (@@FETCH_STATUS <> -1)
BEGIN
	
	IF (@@FETCH_STATUS <> -2)
		SELECT @EffectiveDate,@TerminationDate,@SOCAmount,@RateCode

FETCH NEXT FROM SomeCursor INTO @EffectiveDate, @TerminationDate, @SOCAmount, @RateCode
END	

CLOSE SomeCursor
DEALLOCATE SomeCursor


